<?php
/**
 * Truncate helper
 */
class App_View_Helper_Page_DefaultMenu extends Zend_View_Helper_Abstract
{
	public function page_DefaultMenu($options = null)
	{
		$page = new Page_Model_Page();
		$menus = $page->fetchUncategorized();
		if(!$menus) return;
		$html = '<ul id="page-default-menu">';	

		if(isset($options['includeHomePage']) && $options['includeHomePage']) {
			$homeUrl = $this->view->url(array('module'=>'default','controller'=>'index','action'=>'index',
												'pid'=>null,'t'=>null));
			$html .="<li><a href='$homeUrl'>Accueil</a></li>";
		}
		foreach($menus as $aMenu) {
			//
			$menuUrl =$this->view->url(array('module'=>'page','controller'=>'view','action'=>'article',
											'pid'=>$aMenu['id'],
											't'=>$aMenu['long_title']));
			$menuTitle = $aMenu['title'];
			$html .="<li><a href='$menuUrl'>$menuTitle</a></li>";
		}

		$html .= "</ul>";

		return $html;
	}
}
